import request from '@/utils/request';
import { stringify } from 'qs';
import func from '@/utils/func';

//模糊查询下拉供应商列表 storeName：供应商名称
export async function queryFactoryList(params) {
  return request(`/blade-goods/zjfstore/list/fuzzyQueryPage?${stringify(params)}`);
}

//模糊查询商品列表(spu维度) storeId：供应商id, goodsName: 商品名称
export async function queryCommonGoodsList(params) {
  return request(`/blade-goods/zjfgoodscommon/list/fuzzyQueryPage?${stringify(params)}`);
}

//模糊查询商品列表（sku维度） storeId：供应商id, goodsName: 商品名称
export async function queryGoodsList(params) {
  return request(`/blade-goods/zjfgoods/list/fuzzyQueryPage?${stringify(params)}`);
}

//新增field: storeIds
export async function queryGoodsListNew(params) {
  return request(`/blade-goods/zjfgoods/list/fuzzyQueryPageNew`, {
    method: 'POST',
    data: params,
  });
}

//系统系统商品维度列表查询(sku维度)
export async function querySysGoodsList(params) {
  const pageParams = {
    size: params.size,
    current: params.current
  }
  delete params.size;
  delete params.current;
  if(params.keyWords){
    params.keyWords = params.keyWords.split(',');
  }
  return request(`/blade-goods/sysGoods/getSystemDimension?${stringify(pageParams)}`,{
    method: 'post',
    data: params
  });
}

//查询供应商维度商品列表（sku维度）
export async function queryShopGoodsList(params) {
  return request(`/blade-goods/ecAllgoods/getSystemMaintenance?${stringify(params)}`);
}

//平台店铺下拉列表   支持模糊搜索 :storeName
export async function queryShopList(params) {
  return request(`/blade-goods/ecstore/list?${stringify(params)}`);
}

//商品spu一键识别 goodsid//商品ID
export async function goodsDetail(params) {
  return request(`/blade-goods/deliverSpuUserRel/detail?${stringify(params)}`);
}

//商品sku一键识别 goodsid//商品ID
export async function goodsDetailSku(params) {
  return request(`/blade-goods/zjfgoods/discernGoods?${stringify(params)}`);
}

//获取商品分类
export async function getGcList(params) {
  return request(`/blade-goods/zjfstoregoodsclass/getGoodsClass?${stringify(params)}`);
}

//根据商品spu查询sku信息
export async function getSkuDetail(params) {
  return request(`/blade-goods/zjfgoods/getListSkuDetail?${stringify(params)}`);
}

//查询包装赠品列表(按类型分组：1-赠品 ， 2-包装)
export async function getGiftOrPick() {
  return request(`/blade-goods/manageMeta/list`);
}

//查询包装赠品
export async function getPackageDataOp(params) {
  return request(`/blade-goods/packagingGifts/getPage?${stringify(params)}`);
}

//查询全国省市区列表
export async function getAllArea() {
  return request(`/blade-logistics/area/all`);
}

//添加寄件信息
export async function addMailAddress(params) {
  return request(`/blade-user/useraddress/save`, {
    method: 'post',
    data: params,
  });
}

// 编辑寄件地址
export async function editMailAddress(params) {
  return request(`/blade-user/useraddress/edit`, {
    method: 'POST',
    data: params,
  });
}

//查询全国省列表
export async function getAllProvince() {
  return request(`/blade-logistics/area/childs?id=0`);
}

//查询代发快递列表（不包含快递运费计算）
export async function daifaKv() {
  return request(`/blade-logistics/expressoms/daifaKv`);
}

//查询代发快递列表（包含快递运费计算）
export async function daifaPost(params) {
  return request(`/blade-logistics/expressoms/daifaPost`, {
    method: 'post',
    data: params
  });
}

//查询自发快递列表（不包含快递运费计算）
export async function zifaKv() {
  return request(`/blade-logistics/expressoms/zifaKv`);
}

//查询代发快递列表（包含快递运费计算）
export async function zifaPost(params) {
  return request(`/blade-logistics/expressoms/zifaPost`, {
    method: 'post',
    data: params
  });
}
//查询寄件地址列表
export async function getMailAddress(params) {
  return request(`/blade-user/useraddress/list?${stringify(params)}`);
}

//用户快递列表
export async function getZfExpressList(params) {
  return request(`/blade-logistics/expressoms/zifa?${stringify(params)}`);
}

//找家纺快递列表
export async function getDfExpressList(params) {
  return request(`/blade-logistics/expressoms/daifa?${stringify(params)}`);
}

//添加线下店铺或奇门
export async function saveOfflineStore(params) {
  return request(`/blade-goods/ecstore/save`, {
    method: 'post',
    data: params
  });
}

//校验用户信息是否补充完整
export async function getUserDetail() {
  return request(`/blade-user/detailByuuid`);
}

// 修改当前用户信息
export async function RewriteUserMessage(params) {
  return request('/zjf-oms/user/updateinfo', {
    method: 'PUT',
    data: params,
  });
}

//用户仓库下拉列表
export async function getWarehouseList() {
  return request(`/zjf-oms/userwarehouse/list`);
}

//仓库列表
export async function getWmsWarehouseList() {
  return request(`/zjf-wms/warehouse/list`);
}

//获取网店列表
export async function getShopList(params) {
  return request(`/blade-goods/ecstore/list/page?${stringify(params)}`);
}

//获取子账号信息（或主账号本身）
export async function checkAccount() {
  return request(`/blade-user/user/queryByUserId`);
}

//新增组合商品
export async function addGoods(params) {
  return request(`/blade-goods/compose/add`, {
    method: 'post',
    data: params,
  });
}

//更新组合商品
export async function updateGoods(params) {
  return request(`/blade-goods/compose/update`, {
    method: 'post',
    data: params,
  });
}

//根据类型查询用户渠道列表
export async function queryTypeChannel(params) {
  return request(`/zjf-wms/channel/queryTypeChannel?${stringify(params)}`);
}

//获取抖音打印的参数
export async function queryDouYinPrintParam(params) {
    return request(`/blade-logistics/print/douYinPrintParam?${stringify(params)}`);
}
//渠道下拉 //[0:默认 1：自发渠道，2：自发+所有开放渠道, 3:zjferp用户默认渠道 + uuid的默认]
export async function queryTypeChannelOp(params) {
  return request(`/zjf-wms/channel/queryTypeChannel?${stringify(params)}`);
}

//获取御城河sign
export async function querySign(params) {
    return request(`/blade-goods/taobao/rect/getSign?${stringify(params)}`);
  }

//获取topToken
export async function queryTopToken(params) {
    return request(`/blade-goods/taobao/rect/getTopToken?${stringify(params)}`);
  }

//单号余量预警提示列表
export async function queryExpressNoMonitor(params) {
    return request(`/blade-logistics/userstorefacebill/queryExpressNoMonitor`, {
        method: 'post',
        data: params,
      });
  }

//判断订单状态虚拟号用
export async function orderStatusVirtualNumber(params) {
    return request(`/blade-goods/taobao/rect/orderStatusVirtualNumber`, {
        method: 'post',
        data: params,
      });
  }

//虚拟号延期
export async function virtualNumberExtension(params) {
    return request(`/blade-goods/taobao/rect/virtualNumberExtension`, {
        method: 'post',
        data: params,
      });
  }

//获取登陆bannerList
export async function queryBannerList(params) {
    return request(`/zjf-erp-system/bannerlogin/page?${stringify(params)}`);
}

//查询平安账户状态和绑卡信息
export async function queryPingAnAccount(params) {
    return request(`/zjf-pays/openAccountV3/queryPingAnAccount?${stringify(params)}`);
  }

//区域编码模糊查询
export async function queryAreaCode(params) {
  return request(`/zjf-wms/storecodesort/selectListByName?${stringify(params)}`);
}

// 开户行下拉
export async function bankSearch(params) {
  return request(`/blade-user/banklist/like?${stringify(params)}`);
}
//商品分类属性初始化初始化接口调用
export async function goodscategory(params) {
    return request(`/blade-goods/goodscategory/init`, {
        method: 'post',
        data: params,
      });
  }

//查询商户户列表
export async function getBusinessList(params) {
  return request(`/blade-goods/zjfstore/listStoreName?${stringify(params)}`);
}

//查询用户菜单栏下面的所有功能
export async function getAllButtonList(params) {
    return request(`/zjf-erp-system/open/button/uuid?${stringify(params)}`);
  }

//添加旺店通
export async function wdtAuthToken(params) {
    return request(`/blade-goods/ecstore/wdtAuthToken`, {
      method: 'post',
      data: params
    });
  }

//系统商品维度获取列表分页
export async function getGoodsSkuPage(params) {
	return request(`/new-goods/goods/sku/list`,
    {
		method: "Post",
		data: params,
		loading: true
	});
}

//订单页面获取sku商品分页列表（即尾部带*支持模糊）
export async function getGoodsSkuPageWithStar(params) {
	return request(`/new-goods/goods/sku/get-order-list`,{
    method: 'post',
    body: func.toFormData(params),
  });
}

//获取各种配置信息-页面维度
export function getFieldConfig(params) {
	return request(`/new-common/quickQueryLabel/getByCode?${stringify(params)}`, {
		method: 'GET',
		// baseURL: mockURL,
	});
}

//更新各种配置信息-页面维度
export function updateFieldConfig(params) {
	return request(`/new-common/quickQueryLabel/saveOrUpdate`, {
		method: 'POST',
		data: params,
		// baseURL: mockURL,
	});
}

//账号级别维度获取个性化设置
export function queryPageConfig(params) {
	return request(`/new-common/common/config/get`, {
		method: 'post',
		data: params,
	});
};

//账号级别维度配置个性化设置
export function saveOrUpdatePageConfig(params) {
	return request(`/new-common/common/config/saveOrUpdate`, {
		method: 'post',
		data: params,
	});
};
